<!--
 * @Description: 顶部标题栏
 * @version: 
 * @Author: m
 * @LastEditors: m
-->
<template>
	<van-nav-bar :title="title" left-arrow @click-left="onClickLeft" :border="border" />
</template>

<script>
export default {
	name: "navbar",
	data() {
		return {
			link: this.to,
		};
	},
	props: ["title", "to", "border"],
	methods: {
		onClickLeft() {
			if (!this.$route.meta.backHome) {
				this.$router.go(-1);
			} else {
				this.$router.push(this.$route.meta.backHome);
			}

			this.$emit("pageRegression", null);
		},
	},
	watch: {
		link(newVal) {
			this.link = newVal;
		},
	},
};
</script>

<style lang="scss">
.van-nav-bar {
	background-color: #3187fb;
	color: #fff;

	.van-icon {
		color: #fff;
	}

	.van-nav-bar__title {
		color: #fff;
	}
}
</style>
